﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DAPNet
{
    public class Admixer : IOfflineEffect
    {
        SampleCollection admixSamples;


        public Admixer(SampleCollection admixSamples)
        {
            this.admixSamples = admixSamples;
        }

        public SampleCollection AdmixSamples
        {
            get 
            { 
                return admixSamples; 
            }
            set 
            { 
                admixSamples = value; 
            }
        }

        public void Process(SampleCollection samples)
        {
            if (admixSamples.Count != samples.Count)
            {
                // TODO: EXCEPTION CONSIDERATION.
                throw new ArgumentException();
            }

            for (int i = 0; i < samples.Count; i++)
            {
                double value = samples[i].Value;
                double admixValue = admixSamples[i].Value;
                double mixedValue = value + admixValue;
                samples[i].SetTrimmedValue(mixedValue);
            }
        }
    }
}
